﻿// ----------------------------------------------------------------------------------
// <copyright file="SignContext.cs" company="Christopher Hines">
// Copyright (c) 2012 All Right Reserved
// </copyright>
// <author>Chris Hines</author>
// <date>2012-03-23</date>
// <summary>
//     The SignContext class
// </summary>
// ----------------------------------------------------------------------------------

namespace Copperfield.Demo.Common
{
    using System;

    /// <summary>
    /// The SignContext class
    /// </summary>
    public class SignContext : IComparable
    {
        /// <summary>
        /// Gets or sets the text
        /// </summary>
        private string signText;

        /// <summary>
        /// Gets or sets Color.
        /// </summary>
        public SignColor Color { get; set; }

        /// <summary>
        /// Gets or sets Shape.
        /// </summary>
        public SignShape Shape { get; set; }

        /// <summary>
        /// Gets or sets Text.
        /// </summary>
        public string Text
        {
            get
            {
                return this.signText ?? SignText.Unknown;
            }

            set
            {
                this.signText = value;
            }
        }

        #region CompareTo Snippet
        public int CompareTo(object obj)
        {
            var other = obj as SignContext;

            if (other == null)
            {
                return 1;
            }

            if (ReferenceEquals(this, other))
            {
                return 0;
            }

            if (other.Color != this.Color)
            {
                return 1;
            }

            if (other.Shape != this.Shape)
            {
                return 1;
            }

            if (other.Text != this.Text)
            {
                return 1;
            }

            return 0;
        }
        #endregion
    }
}
